//
//  Kratos_bangdingInputView.m
//  gggg
//
//  Created by K on 2019/1/9.
//  Copyright © 2019 K. All rights reserved.
//

#import "Kratos_bangdingInputView.h"
#import "Kratos_inputCode.h"
#import "Kratos_pwdinput.h"
#import "Kratos_phoneinput.h"
#import "Masonry.h"
#import "k_const.h"

@implementation Kratos_bangdingInputView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if ( self) {
        
        [self configrationUI];
    }
    return self;
}
    

- (Kratos_phoneinput *)Kra_phoneInput
{
    if (_Kra_phoneInput == nil)
    {
        __weak typeof(self) weakSelf = self;
        _Kra_phoneInput = [[Kratos_phoneinput alloc]initWithphoneNumChangeBlock:^(NSString *str) {
            weakSelf.Kra_phoneNumber = str;
        }];
        _Kra_phoneInput.Kra_textField.placeholder = @"请输入手机号码";
        _Kra_phoneInput.Kra_textField.keyboardType = UIKeyboardTypePhonePad;
        _Kra_phoneInput.Kra_pullDownMenu.hidden = true;
        
    }
    return _Kra_phoneInput;
}

- (Kratos_inputCode *)Kra_codeinput
{
    if (_Kra_codeinput == nil)
    {
        __weak typeof(self) weakSelf = self;
        _Kra_codeinput = [[Kratos_inputCode alloc] initWithcodeNumChangeBlock:^(NSString *phone) {
            weakSelf.Kra_phonecode = phone;
            
        } Kratos_countDownBlock:nil Kratos_countDownStrat:^(Kratos_CountDownButton *countDownCode) {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"countDownend" object:weakSelf.Kra_phoneNumber];
        } Kratos_countDownend:^(Kratos_CountDownButton *countDownCode) {
            
        }];
        
    }
    return _Kra_codeinput;
}


- (void)configrationUI
{
    
    
    [self addSubview:self.Kra_phoneInput];
    [self addSubview:self.Kra_codeinput];
    
    [self.Kra_phoneInput mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.mas_top).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
        make.height.mas_equalTo(inputH);
    }];
    
    
    [self.Kra_codeinput mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(10);
        make.top.equalTo(self.Kra_phoneInput.mas_bottom).offset(10);
        make.right.equalTo(self.mas_right).offset(-10);
        make.bottom.equalTo(self.mas_bottom).offset(-5);
        make.height.mas_equalTo(inputH);
        
        
    }];
    
    
    

    
}



@end
